Neon
Volume Number: 1
Issue Number: 8
Column Tag: Neon News
"Object Oriented Programming" 
By Noel J. Bergman, Software Engineer, MCTel, Inc., MacTutor
Contributing Editor
This is the first of a new column object oriented programming. The intent of this
first column is to lay the groundwork for object oriented programm-ing, and to
review the first object oriented language for the Macintosh, NEON from Kriya. In
future columns, we will be using NEON to explore object oriented programming,
possibly with short side trips to examine other object oriented languages, if and when
they appear.
Why object oriented programming?
As you are all undoubtedly aware, programming the Macintosh is not very easy
for most programmers. It is difficult not only for the non-professional programmer:
many professionals are having a great deal of trouble dealing with the Macintosh.
Most, if not all, of the real problems in dealing with the Macintosh come from the fact
that the programs are non-modal. Solutions, such as finite state automata theory, are
not well known and produce artificial program constructs. A much better solution is to
use object oriented programming.
Historical Perspective
Apple got many of its ideas from the Xerox PARC Smalltalk research group headed
by Alan Kay. In fact, a number of that project's members, including Kay himself, are
now at Apple. Alan Kay's greatest vision may have been in programming philosophy,
or methodology. The wonderful user interface envisioned by the PARC group required a
new programming methodology to bring it to life. The one they developed, object
oriented programming, has influenced every major language developed since that time,
most noticably Smalltalk, Ada and Modula-2.
Although a few computer scientists have been aware of, and applying, object
oriented programming for years, the Macintosh has brought home to Apple and
thousands of other programmers, the necessity of teaching and learning these
techniques.
What is Object Oriented programming?
By now, you are probably wondering what object oriented programming means.
What it means is that you define classes of objects, and methods that act upon them. You
declare objects to be of a certain class and act upon them by using the methods
provided. No access to their internal structure is permitted. You create subclasses,
which inherit their storage and methods from their superclass, and may provide
additional local storage and methods that add to or replace those inherited from their
superclass . A concrete example of this is the Macintosh window, which is a subclass
of a QuickDraw grafport, and has additional fields and methods.
This technique allows us to start with a generic application, and to add the
subclasses and methods to implement our own unique application.
In a true object oriented programming language, applications are written by
creating objects that communicate by sending messages to other objects. This message
routing mechanism provides us with the power we need to deal with the Macintosh. The
objects remember what has happened to them, and what their status is. We send them
messages telling them of actions they should perform on themselves.
Only Smalltalk and Neon provide a true object oriented environment. Ada and
Modula-2 only provide you with some level of information hiding; algorithms are still
written in the classical style.
This is an attempt at putting a powerful Smalltalk-like language into the
Macintosh. Kriya has taken a potent 1000 word FORTH nucleus and added everything
necessary for true object oriented programming, i.e. objects (classes, methods,
subclasses) and messaging. They have also enhanced the basic FORTH language with all
sorts of nice features for programmers, such as local variables and named parameters.
Much of the bite of having to deal with FORTH's simple minded stack is gone, so those of
us that dislike FORTH intensely, can enjoy NEON immensely.
NEON does everything one needs to make a standalone (i.e. double-click to start)
Macintosh application. Access to the full Macintosh toolbox is there, plus object
classes that provide higher level access to most Macintosh objects, e.g. windows.
The documentation for NEON is outstanding. From the begining they acknowledge
that object oriented programming is a new concept to most NEON purchasers. Danny
Goodman, author of a number of Apple related books and articles, has written a 19
chapter NEON tutorial, which takes you throught NEON's object oriented nature, and
the FORTH concepts necessary to write NEON prgorams, step by step.
Also in the Tutorial binder, is a section that describes the NEON system in detail,
from the menu bar to putting together a finished NEON application.
A second binder, the reference manual, details every class, and its methods,
included with the NEON system. A glossary of all the FORTH and NEON words rounds out
the NEON documentation.
In the event that you want even more documentation for NEON, Kriya has provided
the source for most the the NEON system above the basic FORTH kernel, as well as an
additional complete application.
FORTH compatibility
According to Kriya, NEON will run most FORTH-83 programs with little or no
changes. The FORTH heritage of NEON is apparent in its speed, also. Since my Lisa
runs at 5 mhz, Kriya provided the Macintosh sieve benchmark of 3 seconds.
Future NEON features